#include "Color.h"
#include "Functions.h"
Color::Color()
{
	r = 0; g = 0; b = 0; a = 255;
}
Color::Color(int _r, int _g, int _b)
{
	r = _r; g = _g; b = _b;
	a = 255;
}
Color::Color(int r, int g, int b, int a)
{
	this->r = r; this->g = g; this->b = b; this->a = a;
}
Color::Color(OSL_COLOR c)
{
	u8 tr, tg, tb, ta;
	oslRgbaGet8888(c, tr, tg, tb, ta);
	r = tr; g = tg; b = tb; a = ta;
}
Color Color::operator =(OSL_COLOR c)
{
	u8 tr, tg, tb, ta;
	oslRgbaGet8888(c, tr, tg, tb, ta);
	r = tr; g = tg; b = tb; a = ta;
	return Color(r,g,b,a);
}
void Color::set(Color c)
{
	r = c.getR(); g = c.getG(); b = c.getB(); a = c.getA();
}
void Color::set(OSL_COLOR c)
{
	u8 tr, tg, tb, ta;
	oslRgbaGet8888(c, tr, tg, tb, ta);
	r = tr; g = tg; b = tb; a = ta;
}
void Color::set(int r, int g, int b, int a)
{
	this->r = r; this->g = g; this->b = b; this->a = a;
}
void Color::set(int r, int g, int b)
{
	this->r = r; this->g = g; this->b = b; a = 255;
}
void Color::setR(int r)
{
	this->r = r;
}
void Color::setG(int g)
{
	this->g = g;
}
void Color::setB(int b)
{
	this->b = b;
}
void Color::setA(int a)
{
	this->a = a;
}
int Color::getR()
{
	return r;
}
int Color::getG()
{
	return g;
}
int Color::getB()
{
	return b;
}
int Color::getA()
{
	return a;
}
unsigned int Color::gu_c()
{
	return GU_COLOR(r,g,b,a);
}
OSL_COLOR Color::osl_c()
{
	return RGBA(r,g,b,a);
}
OSL_COLOR Color::toOSL_COLOR()
{
	return RGBA(r,g,b,a);
}
string Color::toString()
{
	string rstr = "";
	rstr += "r = "; rstr += intToString(r);
	rstr += "; g = "; rstr += intToString(g);
	rstr += "; b = "; rstr += intToString(b);
	rstr += "; a = "; rstr += intToString(a);
	rstr += ";"; return rstr;
}
